package com.heima.admin.controller;

import com.heima.admin.service.AdminService;
import com.heima.model.common.admin.dtos.AdUserDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/login")
@Slf4j
public class LoginController {
    @Autowired
    private AdminService adminService;

    /**
     * 登陆
     * @param adUserDto
     * @return
     */
    @PostMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto adUserDto){
        log.info("登录的用户{}",adUserDto);
        return adminService.login(adUserDto);
    }
}
